package com.ibm.interview.brno;

public class PrimeNumberJavaInterview {

    public void printOutPrimeNumber(final int [] input) {
        for (int number: input) {
            System.out.println(number + " isPrime: " + isPrime(number));
        }
    }

    private boolean isPrime(int n) {
        if (n == 2) return true;
        if (n % 2 == 0 || n == 1) return false;
        for (int i = 3; i*i <=n; i+=2) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
